import request from "@/netword/request";


const fun = {};


// 分页查询所有信息
fun.getList = async (culture) => {
    const res = await request({
        url: "/a/content/culture/list",
        method: "post",
        params: {
            cultureTitle: culture.cultureTitle,
            pageNo: culture.pageNo,
            pageSize: culture.pageSize,
        }
    })
    return res.data;
}



//保存数据
fun.saveCulture = async (culture) => {
    const res = await request({
        url: "/a/content/culture/save",
        method: "put",
        params: {
            cultureImage:culture.cultureImage,
            cultureTitle:culture.cultureTitle,
            sort:culture.sort,
            remarks:culture.remarks,
        }
    })
    return res.data;
}



//更新数据
fun.updateCulture = async (culture) => {
    const res = await request({
        url: "/a/content/culture/update",
        method: "post",
        params: {
            id: culture.id,
            cultureImage:culture.cultureImage,
            cultureTitle:culture.cultureTitle,
            sort:culture.sort,
            remarks:culture.remarks,
        }
    })
    return res.data;
}



//修改数据状态（正常，停用，删除）
fun.saveStatus = async (id,status) => {
    const res = await request({
        url: "/a/content/culture/updateStatus",
        method: "post",
        params: {
            id: id,
            status:status
        }
    })
    return res.data;
}


//查询单条数据
fun.getCulture = async (id) => {
    const res = await request({
        url: "/a/content/culture/get",
        method: "get",
        params: {
            id: id
        }
    })
    return res.data;
}


export default fun;